package com.briup.smartlabs.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.briup.smartlabs.bean.SmartLabs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.briup.smartlabs.bean.ex.SysLog;
import com.briup.smartlabs.mapper.ex.SysLogMapper;
import com.briup.smartlabs.service.SysLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service
public class SysLogServiceImpl implements SysLogService{
	@Autowired
	private SysLogMapper logMapper;


	@Override
	public PageInfo<SysLog> findByCondition(int pageNum, int pageSize, String key) {
		//1.使用pagehelper开启分页
		PageHelper.startPage(pageNum,pageSize);
//		2.正常条件查询（不用limit）
//		如果要进行模糊查询，在sql中没有加%的话需要在代码中处理
//		if(key !=null) {
//		key = "%"+key+"%";
//		}
		key = key != null? "%"+ key +"%":null;
		List<SysLog> sysLogs = logMapper.selectAllByBeginEnd(key);
		System.out.println(sysLogs);
		//3.构建pageInfo对象
		return new PageInfo<>(sysLogs);
	}
}





